#include <atomic>
#include <iostream>
#include <thread>

std::atomic_flag f;
std::atomic_int b;

int main(){
    std::cout << f.test_and_set() << std::endl;
    std::cout << f.test_and_set() << std::endl;
    std::cout << f.test_and_set() << std::endl;
    std::atomic_int a(10);
    int i = 20;
    std::cout << a.compare_exchange_weak(i, 30) << std::endl;
    std::cout << a.load() << " " << i << std::endl;
    std::cout << a.compare_exchange_weak(i, 30) << std::endl;
    std::cout << a.load() << " " << i << std::endl;

    std::cout << b.load(std::memory_order_acquire) << std::endl;

    return 0;
}